home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_emacs.idb / usr / freeware / info / emacs-19.z / emacs-19
Encoding:
GNU Info File  |  1998-10-28  |  48.6 KB  |  1,142 lines

  1. This is Info file ../info/emacs, produced by Makeinfo-1.63 from the
  2. input file emacs.texi.
  3.  
  4. 
  5. File: emacs,  Node: Sorting,  Next: Narrowing,  Prev: Postscript,  Up: Top
  6.  
  7. Sorting Text
  8. ============
  9.  
  10.    Emacs provides several commands for sorting text in the buffer.  All
  11. operate on the contents of the region (the text between point and the
  12. mark).  They divide the text of the region into many "sort records",
  13. identify a "sort key" for each record, and then reorder the records
  14. into the order determined by the sort keys.  The records are ordered so
  15. that their keys are in alphabetical order, or, for numeric sorting, in
  16. numeric order.  In alphabetic sorting, all upper case letters `A'
  17. through `Z' come before lower case `a', in accord with the ASCII
  18. character sequence.
  19.  
  20.    The various sort commands differ in how they divide the text into
  21. sort records and in which part of each record is used as the sort key.
  22. Most of the commands make each line a separate sort record, but some
  23. commands use paragraphs or pages as sort records.  Most of the sort
  24. commands use each entire sort record as its own sort key, but some use
  25. only a portion of the record as the sort key.
  26.  
  27. `M-x sort-lines'
  28.      Divide the region into lines, and sort by comparing the entire
  29.      text of a line.  A numeric argument means sort into descending
  30.      order.
  31.  
  32. `M-x sort-paragraphs'
  33.      Divide the region into paragraphs, and sort by comparing the entire
  34.      text of a paragraph (except for leading blank lines).  A numeric
  35.      argument means sort into descending order.
  36.  
  37. `M-x sort-pages'
  38.      Divide the region into pages, and sort by comparing the entire
  39.      text of a page (except for leading blank lines).  A numeric
  40.      argument means sort into descending order.
  41.  
  42. `M-x sort-fields'
  43.      Divide the region into lines, and sort by comparing the contents of
  44.      one field in each line.  Fields are defined as separated by
  45.      whitespace, so the first run of consecutive non-whitespace
  46.      characters in a line constitutes field 1, the second such run
  47.      constitutes field 2, etc.
  48.  
  49.      Specify which field to sort by with a numeric argument: 1 to sort
  50.      by field 1, etc.  A negative argument means count fields from the
  51.      right instead of from the left; thus, minus 1 means sort by the
  52.      last field.  If several lines have identical contents in the field
  53.      being sorted, they keep same relative order that they had in the
  54.      original buffer.
  55.  
  56.      A negative argument means count fields from the right (from the
  57.      end of the line).
  58.  
  59. `M-x sort-numeric-fields'
  60.      Like `M-x sort-fields' except the specified field is converted to
  61.      an integer for each line, and the numbers are compared.  `10'
  62.      comes before `2' when considered as text, but after it when
  63.      considered as a number.
  64.  
  65. `M-x sort-columns'
  66.      Like `M-x sort-fields' except that the text within each line used
  67.      for comparison comes from a fixed range of columns.  See below for
  68.      an explanation.
  69.  
  70. `M-x reverse-region'
  71.      Reverse the order of the lines in the region.  This is useful for
  72.      sorting into descending order by fields or columns, since those
  73.      sort commands do not have a feature for doing that.
  74.  
  75.    For example, if the buffer contains this:
  76.  
  77.      On systems where clash detection (locking of files being edited) is
  78.      implemented, Emacs also checks the first time you modify a buffer
  79.      whether the file has changed on disk since it was last visited or
  80.      saved.  If it has, you are asked to confirm that you want to change
  81.      the buffer.
  82.  
  83. applying `M-x sort-lines' to the entire buffer produces this:
  84.  
  85.      On systems where clash detection (locking of files being edited) is
  86.      implemented, Emacs also checks the first time you modify a buffer
  87.      saved.  If it has, you are asked to confirm that you want to change
  88.      the buffer.
  89.      whether the file has changed on disk since it was last visited or
  90.  
  91. where the upper case `O' sorts before all lower case letters.  If you
  92. use `C-u 2 M-x sort-fields' instead, you get this:
  93.  
  94.      implemented, Emacs also checks the first time you modify a buffer
  95.      saved.  If it has, you are asked to confirm that you want to change
  96.      the buffer.
  97.      On systems where clash detection (locking of files being edited) is
  98.      whether the file has changed on disk since it was last visited or
  99.  
  100. where the sort keys were `Emacs', `If', `buffer', `systems' and `the'.
  101.  
  102.    `M-x sort-columns' requires more explanation.  You specify the
  103. columns by putting point at one of the columns and the mark at the other
  104. column.  Because this means you cannot put point or the mark at the
  105. beginning of the first line to sort, this command uses an unusual
  106. definition of `region': all of the line point is in is considered part
  107. of the region, and so is all of the line the mark is in, as well as all
  108. the lines in between.
  109.  
  110.    For example, to sort a table by information found in columns 10 to
  111. 15, you could put the mark on column 10 in the first line of the table,
  112. and point on column 15 in the last line of the table, and then run
  113. `sort-columns'.  Equivalently, you could run it with the mark on column
  114. 15 in the first line and point on column 10 in the last line.
  115.  
  116.    This can be thought of as sorting the rectangle specified by point
  117. and the mark, except that the text on each line to the left or right of
  118. the rectangle moves along with the text inside the rectangle.  *Note
  119. Rectangles::.
  120.  
  121.    Many of the sort commands ignore case differences when comparing, if
  122. `sort-fold-case' is non-`nil'.
  123.  
  124. 
  125. File: emacs,  Node: Narrowing,  Next: Two-Column,  Prev: Sorting,  Up: Top
  126.  
  127. Narrowing
  128. =========
  129.  
  130.    "Narrowing" means focusing in on some portion of the buffer, making
  131. the rest temporarily inaccessible.  The portion which you can still get
  132. to is called the "accessible portion".  Canceling the narrowing, which
  133. makes the entire buffer once again accessible, is called "widening".
  134. The amount of narrowing in effect in a buffer at any time is called the
  135. buffer's "restriction".
  136.  
  137.    Narrowing can make it easier to concentrate on a single subroutine or
  138. paragraph by eliminating clutter.  It can also be used to restrict the
  139. range of operation of a replace command or repeating keyboard macro.
  140.  
  141. `C-x n n'
  142.      Narrow down to between point and mark (`narrow-to-region').
  143.  
  144. `C-x n w'
  145.      Widen to make the entire buffer accessible again (`widen').
  146.  
  147. `C-x n p'
  148.      Narrow down to the current page (`narrow-to-page').
  149.  
  150.    When you have narrowed down to a part of the buffer, that part
  151. appears to be all there is.  You can't see the rest, you can't move
  152. into it (motion commands won't go outside the accessible part), you
  153. can't change it in any way.  However, it is not gone, and if you save
  154. the file all the inaccessible text will be saved.  The word `Narrow'
  155. appears in the mode line whenever narrowing is in effect.
  156.  
  157.    The primary narrowing command is `C-x n n' (`narrow-to-region').  It
  158. sets the current buffer's restrictions so that the text in the current
  159. region remains accessible but all text before the region or after the
  160. region is inaccessible.  Point and mark do not change.
  161.  
  162.    Alternatively, use `C-x n p' (`narrow-to-page') to narrow down to
  163. the current page.  *Note Pages::, for the definition of a page.
  164.  
  165.    The way to cancel narrowing is to widen with `C-x n w' (`widen').
  166. This makes all text in the buffer accessible again.
  167.  
  168.    You can get information on what part of the buffer you are narrowed
  169. down to using the `C-x =' command.  *Note Position Info::.
  170.  
  171.    Because narrowing can easily confuse users who do not understand it,
  172. `narrow-to-region' is normally a disabled command.  Attempting to use
  173. this command asks for confirmation and gives you the option of enabling
  174. it; if you enable the command, confirmation will no longer be required
  175. for it.  *Note Disabling::.
  176.  
  177. 
  178. File: emacs,  Node: Two-Column,  Next: Editing Binary Files,  Prev: Narrowing,  Up: Top
  179.  
  180. Two-Column Editing
  181. ==================
  182.  
  183.    Two-column mode lets you conveniently edit two side-by-side columns
  184. of text.  It uses two side-by-side windows, each showing its own buffer.
  185.  
  186.    There are three ways to enter two-column mode:
  187.  
  188. `f2 2' or `C-x 6 2'
  189.      Enter two-column mode with the current buffer on the left, and on
  190.      the right, a buffer whose name is based on the current buffer's
  191.      name (`2C-two-columns').  If the right-hand buffer doesn't already
  192.      exist, it starts out empty; the current buffer's contents are not
  193.      changed.
  194.  
  195.      This command is appropriate when the current buffer is empty or
  196.      contains just one column and you want to add another column.
  197.  
  198. `f2 s' or `C-x 6 s'
  199.      Split the current buffer, which contains two-column text, into two
  200.      buffers, and display them side by side (`2C-split').  The current
  201.      buffer becomes the left-hand buffer, but the text in the right-hand
  202.      column is moved into the right-hand buffer.  The current column
  203.      specifies the split point.  Splitting starts with the current line
  204.      and continues to the end of the buffer.
  205.  
  206.      This command is appropriate when you have a buffer that already
  207.      contains two-column text, and you wish to separate the columns
  208.      temporarily.
  209.  
  210. `f2 b BUFFER RET'
  211. `C-x 6 b BUFFER RET'
  212.      Enter two-column mode using the current buffer as the left-hand
  213.      buffer, and using buffer BUFFER as the right-hand buffer
  214.      (`2C-associate-buffer').
  215.  
  216.    `f2 s' or `C-x 6 s' looks for a column separator which is a string
  217. that appears on each line between the two columns.  You can specify the
  218. width of the separator with a numeric argument to `f2 s'; that many
  219. characters, before point, constitute the separator string.  By default,
  220. the width is 1, so the column separator is the character before point.
  221.  
  222.    When a line has the separator at the proper place, `f2 s' puts the
  223. text after the separator into the right-hand buffer, and deletes the
  224. separator.  Lines that don't have the column separator at the proper
  225. place remain unsplit; they stay in the left-hand buffer, and the
  226. right-hand buffer gets an empty line to correspond.  (This is the way to
  227. write a line which "spans both columns while in two-column mode": write
  228. it in the left-hand buffer, and put an empty line in the right-hand
  229. buffer.)
  230.  
  231.    The command `C-x 6 RET' or `f2 RET' (`2C-newline') inserts a newline
  232. in each of the two buffers at corresponding positions.  This is the
  233. easiest way to add a new line to the two-column text while editing it
  234. in split buffers.
  235.  
  236.    When you have edited both buffers as you wish, merge them with `f2
  237. 1' or `C-x 6 1' (`2C-merge').  This copies the text from the right-hand
  238. buffer as a second column in the other buffer.  To go back to
  239. two-column editing, use `f2 s'.
  240.  
  241.    Use `f2 d' or `C-x 6 d' to disassociate the two buffers, leaving
  242. each as it stands (`2C-dissociate').  If the other buffer, the one not
  243. current when you type `f2 d', is empty, `f2 d' kills it.
  244.  
  245. 
  246. File: emacs,  Node: Editing Binary Files,  Next: Saving Emacs Sessions,  Prev: Two-Column,  Up: Top
  247.  
  248. Editing Binary Files
  249. ====================
  250.  
  251.    There is a special major mode for editing binary files: Hexl mode.
  252. To use it, use `M-x hexl-find-file' instead of `C-x C-f' to visit the
  253. file.  This command converts the file's contents to hexadecimal and
  254. lets you edit the translation.  When you save the file, it is converted
  255. automatically back to binary.
  256.  
  257.    You can also use `M-x hexl-mode' to translate an existing buffer
  258. into hex.  This is useful if you visit a file normally and then discover
  259. it is a binary file.
  260.  
  261.    Ordinary text characters overwrite in Hexl mode.  This is to reduce
  262. the risk of accidentally spoiling the alignment of data in the file.
  263. There are special commands for insertion.  Here is a list of the
  264. commands of Hexl mode:
  265.  
  266. `C-M-d'
  267.      Insert a byte with a code typed in decimal.
  268.  
  269. `C-M-o'
  270.      Insert a byte with a code typed in octal.
  271.  
  272. `C-M-x'
  273.      Insert a byte with a code typed in hex.
  274.  
  275. `C-x ['
  276.      Move to the beginning of a 1k-byte "page".
  277.  
  278. `C-x ]'
  279.      Move to the end of a 1k-byte "page".
  280.  
  281. `M-g'
  282.      Move to an address specified in hex.
  283.  
  284. `M-j'
  285.      Move to an address specified in decimal.
  286.  
  287. `C-c C-c'
  288.      Leave Hexl mode, going back to the major mode this buffer had
  289.      before you invoked `hexl-mode'.
  290.  
  291. 
  292. File: emacs,  Node: Saving Emacs Sessions,  Next: Recursive Edit,  Prev: Editing Binary Files,  Up: Top
  293.  
  294. Saving Emacs Sessions
  295. =====================
  296.  
  297.    You can use the Desktop library to save the state of Emacs from one
  298. session to another.  Saving the state means that Emacs starts up with
  299. the same set of buffers, major modes, buffer positions, and so on that
  300. the previous Emacs session had.
  301.  
  302.    To use Desktop, you should first add these lines at the end of your
  303. `.emacs' file:
  304.  
  305.      (load "desktop")
  306.      (desktop-load-default)
  307.      (desktop-read)
  308.  
  309. The first time you save the state of the Emacs session, you must do it
  310. manually, with the command `M-x desktop-save'.  Once you have done
  311. that, exiting Emacs will save the state again--not only the present
  312. Emacs session, but also subsequent sessions.  You can also save the
  313. state at any time, without exiting Emacs, by typing `M-x desktop-save'
  314. again.
  315.  
  316.    In order for Emacs to recover the state from a previous session, you
  317. must start it with the same current directory as you used when you
  318. started the previous session.
  319.  
  320.    The variable `desktop-files-not-to-save' controls which files are
  321. excluded from state saving.  Its value is a regular expression that
  322. matches the files to exclude.  By default, remote (ftp-accessed) files
  323. are excluded; this is because visiting them again in the subsequent
  324. session would be slow.  If you want to include these files in state
  325. saving, set `desktop-files-not-to-save' to `"^$"'.
  326.  
  327. 
  328. File: emacs,  Node: Recursive Edit,  Next: Emulation,  Prev: Saving Emacs Sessions,  Up: Top
  329.  
  330. Recursive Editing Levels
  331. ========================
  332.  
  333.    A "recursive edit" is a situation in which you are using Emacs
  334. commands to perform arbitrary editing while in the middle of another
  335. Emacs command.  For example, when you type `C-r' inside of a
  336. `query-replace', you enter a recursive edit in which you can change the
  337. current buffer.  On exiting from the recursive edit, you go back to the
  338. `query-replace'.
  339.  
  340.    "Exiting" the recursive edit means returning to the unfinished
  341. command, which continues execution.  The command to exit is `C-M-c'
  342. (`exit-recursive-edit').
  343.  
  344.    You can also "abort" the recursive edit.  This is like exiting, but
  345. also quits the unfinished command immediately.  Use the command `C-]'
  346. (`abort-recursive-edit') to do this.  *Note Quitting::.
  347.  
  348.    The mode line shows you when you are in a recursive edit by
  349. displaying square brackets around the parentheses that always surround
  350. the major and minor mode names.  Every window's mode line shows this,
  351. in the same way, since being in a recursive edit is true of Emacs as a
  352. whole rather than any particular window or buffer.
  353.  
  354.    It is possible to be in recursive edits within recursive edits.  For
  355. example, after typing `C-r' in a `query-replace', you may type a
  356. command that enters the debugger.  This begins a recursive editing level
  357. for the debugger, within the recursive editing level for `C-r'.  Mode
  358. lines display a pair of square brackets for each recursive editing
  359. level currently in progress.
  360.  
  361.    Exiting the inner recursive edit (such as, with the debugger `c'
  362. command) resumes the command running in the next level up.  When that
  363. command finishes, you can then use `C-M-c' to exit another recursive
  364. editing level, and so on.  Exiting applies to the innermost level only.
  365. Aborting also gets out of only one level of recursive edit; it returns
  366. immediately to the command level of the previous recursive edit.  If you
  367. wish, you can then abort the next recursive editing level.
  368.  
  369.    Alternatively, the command `M-x top-level' aborts all levels of
  370. recursive edits, returning immediately to the top level command reader.
  371.  
  372.    The text being edited inside the recursive edit need not be the same
  373. text that you were editing at top level.  It depends on what the
  374. recursive edit is for.  If the command that invokes the recursive edit
  375. selects a different buffer first, that is the buffer you will edit
  376. recursively.  In any case, you can switch buffers within the recursive
  377. edit in the normal manner (as long as the buffer-switching keys have
  378. not been rebound).  You could probably do all the rest of your editing
  379. inside the recursive edit, visiting files and all.  But this could have
  380. surprising effects (such as stack overflow) from time to time.  So
  381. remember to exit or abort the recursive edit when you no longer need it.
  382.  
  383.    In general, we try to minimize the use of recursive editing levels in
  384. GNU Emacs.  This is because they constrain you to "go back" in a
  385. particular order-from the innermost level toward the top level.  When
  386. possible, we present different activities in separate buffers so that
  387. you can switch between them as you please.  Some commands switch to a
  388. new major mode which provides a command to switch back.  These
  389. approaches give you more flexibility to go back to unfinished tasks in
  390. the order you choose.
  391.  
  392. 
  393. File: emacs,  Node: Emulation,  Next: Dissociated Press,  Prev: Recursive Edit,  Up: Top
  394.  
  395. Emulation
  396. =========
  397.  
  398.    GNU Emacs can be programmed to emulate (more or less) most other
  399. editors.  Standard facilities can emulate these:
  400.  
  401. EDT (DEC VMS editor)
  402.      Turn on EDT emulation with `M-x edt-emulation-on'.  `M-x
  403.      edt-emulation-off' restores normal Emacs command bindings.
  404.  
  405.      Most of the EDT emulation commands are keypad keys, and most
  406.      standard Emacs key bindings are still available.  The EDT
  407.      emulation rebindings are done in the global keymap, so there is no
  408.      problem switching buffers or major modes while in EDT emulation.
  409.  
  410. vi (Berkeley editor)
  411.      Viper is the newest emulator for vi.  It implements several levels
  412.      of emulation; level 1 is closest to vi itself, while level 5
  413.      departs somewhat from strict emulation to take advantage of the
  414.      capabilities of Emacs.  To invoke Viper, type `M-x viper-mode'; it
  415.      will guide you the rest of the way and ask for the emulation level.
  416.  
  417. vi (another emulator)
  418.      `M-x vi-mode' enters a major mode that replaces the previously
  419.      established major mode.  All of the vi commands that, in real vi,
  420.      enter "input" mode are programmed instead to return to the
  421.      previous major mode.  Thus, ordinary Emacs serves as vi's "input"
  422.      mode.
  423.  
  424.      Because vi emulation works through major modes, it does not work
  425.      to switch buffers during emulation.  Return to normal Emacs first.
  426.  
  427.      If you plan to use vi emulation much, you probably want to bind a
  428.      key to the `vi-mode' command.
  429.  
  430. vi (alternate emulator)
  431.      `M-x vip-mode' invokes another vi emulator, said to resemble real
  432.      vi more thoroughly than `M-x vi-mode'.  "Input" mode in this
  433.      emulator is changed from ordinary Emacs so you can use ESC to go
  434.      back to emulated vi command mode.  To get from emulated vi command
  435.      mode back to ordinary Emacs, type `C-z'.
  436.  
  437.      This emulation does not work through major modes, and it is
  438.      possible to switch buffers in various ways within the emulator.
  439.      It is not so necessary to assign a key to the command `vip-mode' as
  440.      it is with `vi-mode' because terminating insert mode does not use
  441.      it.
  442.  
  443.      For full information, see the long comment at the beginning of the
  444.      source file, which is `lisp/vip.el' in the Emacs distribution.
  445.  
  446. 
  447. File: emacs,  Node: Dissociated Press,  Next: Amusements,  Prev: Emulation,  Up: Top
  448.  
  449. Dissociated Press
  450. =================
  451.  
  452.    `M-x dissociated-press' is a command for scrambling a file of text
  453. either word by word or character by character.  Starting from a buffer
  454. of straight English, it produces extremely amusing output.  The input
  455. comes from the current Emacs buffer.  Dissociated Press writes its
  456. output in a buffer named `*Dissociation*', and redisplays that buffer
  457. after every couple of lines (approximately) so you can read the output
  458. as it comes out.
  459.  
  460.    Dissociated Press asks every so often whether to continue generating
  461. output.  Answer `n' to stop it.  You can also stop at any time by
  462. typing `C-g'.  The dissociation output remains in the `*Dissociation*'
  463. buffer for you to copy elsewhere if you wish.
  464.  
  465.    Dissociated Press operates by jumping at random from one point in the
  466. buffer to another.  In order to produce plausible output rather than
  467. gibberish, it insists on a certain amount of overlap between the end of
  468. one run of consecutive words or characters and the start of the next.
  469. That is, if it has just printed out `president' and then decides to jump
  470. to a different point in the file, it might spot the `ent' in `pentagon'
  471. and continue from there, producing `presidentagon'.(1)  Long sample
  472. texts produce the best results.
  473.  
  474.    A positive argument to `M-x dissociated-press' tells it to operate
  475. character by character, and specifies the number of overlap characters.
  476. A negative argument tells it to operate word by word and specifies the
  477. number of overlap words.  In this mode, whole words are treated as the
  478. elements to be permuted, rather than characters.  No argument is
  479. equivalent to an argument of two.  For your againformation, the output
  480. goes only into the buffer `*Dissociation*'.  The buffer you start with
  481. is not changed.
  482.  
  483.    Dissociated Press produces nearly the same results as a Markov chain
  484. based on a frequency table constructed from the sample text.  It is,
  485. however, an independent, ignoriginal invention.  Dissociated Press
  486. techniquitously copies several consecutive characters from the sample
  487. between random choices, whereas a Markov chain would choose randomly for
  488. each word or character.  This makes for more plausible sounding results,
  489. and runs faster.
  490.  
  491.    It is a mustatement that too much use of Dissociated Press can be a
  492. developediment to your real work.  Sometimes to the point of outragedy.
  493. And keep dissociwords out of your documentation, if you want it to be
  494. well userenced and properbose.  Have fun.  Your buggestions are welcome.
  495.  
  496.    ---------- Footnotes ----------
  497.  
  498.    (1)  This dissociword actually appeared during the Vietnam War, when
  499. it was very appropriate.
  500.  
  501. 
  502. File: emacs,  Node: Amusements,  Next: Customization,  Prev: Dissociated Press,  Up: Top
  503.  
  504. Other Amusements
  505. ================
  506.  
  507.    If you are a little bit bored, you can try `M-x hanoi'.  If you are
  508. considerably bored, give it a numeric argument.  If you are very very
  509. bored, try an argument of 9.  Sit back and watch.
  510.  
  511.    If you want a little more personal involvement, try `M-x gomoku',
  512. which plays the game Go Moku with you.
  513.  
  514.    `M-x blackbox' and `M-x mpuz' are two kinds of puzzles.  `blackbox'
  515. challenges you to determine the location of objects inside a box by
  516. tomography.  `mpuz' displays a multiplication puzzle with letters
  517. standing for digits in a code that you must guess--to guess a value,
  518. type a letter and then the digit you think it stands for.
  519.  
  520.    `M-x dunnet' runs an adventure-style exploration game, which is a
  521. bigger sort of puzzle.
  522.  
  523.    When you are frustrated, try the famous Eliza program.  Just do `M-x
  524. doctor'.  End each input by typing `RET' twice.
  525.  
  526.    When you are feeling strange, type `M-x yow'.
  527.  
  528. 
  529. File: emacs,  Node: Customization,  Next: Quitting,  Prev: Amusements,  Up: Top
  530.  
  531. Customization
  532. *************
  533.  
  534.    This chapter talks about various topics relevant to adapting the
  535. behavior of Emacs in minor ways.  See `The Emacs Lisp Reference Manual'
  536. for how to make more far-reaching changes.
  537.  
  538.    All kinds of customization affect only the particular Emacs session
  539. that you do them in.  They are completely lost when you kill the Emacs
  540. session, and have no effect on other Emacs sessions you may run at the
  541. same time or later.  The only way an Emacs session can affect anything
  542. outside of it is by writing a file; in particular, the only way to make
  543. a customization `permanent' is to put something in your `.emacs' file
  544. or other appropriate file to do the customization in each session.
  545. *Note Init File::.
  546.  
  547. * Menu:
  548.  
  549. * Minor Modes::           Each minor mode is one feature you can turn on
  550.                  independently of any others.
  551. * Variables::           Many Emacs commands examine Emacs variables
  552.                  to decide what to do; by setting variables,
  553.                  you can control their functioning.
  554. * Keyboard Macros::       A keyboard macro records a sequence of
  555.                  keystrokes to be replayed with a single
  556.                  command.
  557. * Key Bindings::       The keymaps say what command each key runs.
  558.                  By changing them, you can "redefine keys".
  559. * Keyboard Translations::  If your keyboard passes an undesired code
  560.                  for a key, you can tell Emacs to
  561.                  substitute another code.
  562. * Syntax::           The syntax table controls how words and
  563.                   expressions are parsed.
  564. * Init File::           How to write common customizations in the
  565.                              `.emacs' file.
  566.  
  567. 
  568. File: emacs,  Node: Minor Modes,  Next: Variables,  Up: Customization
  569.  
  570. Minor Modes
  571. ===========
  572.  
  573.    Minor modes are optional features which you can turn on or off.  For
  574. example, Auto Fill mode is a minor mode in which SPC breaks lines
  575. between words as you type.  All the minor modes are independent of each
  576. other and of the selected major mode.  Most minor modes say in the mode
  577. line when they are on; for example, `Fill' in the mode line means that
  578. Auto Fill mode is on.
  579.  
  580.    Append `-mode' to the name of a minor mode to get the name of a
  581. command function that turns the mode on or off.  Thus, the command to
  582. enable or disable Auto Fill mode is called `M-x auto-fill-mode'.  These
  583. commands are usually invoked with `M-x', but you can bind keys to them
  584. if you wish.  With no argument, the function turns the mode on if it was
  585. off and off if it was on.  This is known as "toggling".  A positive
  586. argument always turns the mode on, and an explicit zero argument or a
  587. negative argument always turns it off.
  588.  
  589.    Enabling or disabling some minor modes applies only to the current
  590. buffer; each buffer is independent of the other buffers.  Therefore, you
  591. can enable the mode in particular buffers and disable it in others.  The
  592. per-buffer minor modes include Auto Fill mode, Auto Save mode, Font-Lock
  593. mode, ISO Accents mode, Outline minor mode, Overwrite mode, and Binary
  594. Overwrite mode.
  595.  
  596.    Auto Fill mode allows you to enter filled text without breaking lines
  597. explicitly.  Emacs inserts newlines as necessary to prevent lines from
  598. becoming too long.  *Note Filling::.
  599.  
  600.    Auto Save mode causes the contents of a buffer to be saved
  601. periodically to reduce the amount of work you can lose in case of a
  602. system crash.  *Note Auto Save::.
  603.  
  604.    Enriched mode enables editing and saving of formatted text.  *Note
  605. Formatted Text::.
  606.  
  607.    Font-Lock mode automatically highlights certain textual units found
  608. in programs, such as comments, strings, and function names being
  609. defined.  This requires a window system that can display multiple fonts.
  610. *Note Faces::.
  611.  
  612.    ISO Accents mode makes the characters ``', `'', `"', `^', `/' and
  613. `~' combine with the following letter, to produce an accented letter in
  614. the ISO Latin-1 character set.  *Note European Display::.
  615.  
  616.    Outline minor mode provides the same facilities as the major mode
  617. called Outline mode; but since it is a minor mode instead, you can
  618. combine it with any major mode.  *Note Outline Mode::.
  619.  
  620.    Overwrite mode causes ordinary printing characters to replace
  621. existing text instead of shoving it to the right.  For example, if
  622. point is in front of the `B' in `FOOBAR', then in Overwrite mode typing
  623. a `G' changes it to `FOOGAR', instead of producing it `FOOGBAR' as
  624. usual.  Binary Overwrite mode is a variant of Overwrite mode for
  625. editing binary files; it treats newlines and tabs like other
  626. characters, so that they overwrite other characters and can be
  627. overwritten by them.
  628.  
  629.    The following minor modes normally apply to all buffers at once.
  630. Since each is enabled or disabled by the value of a variable, you *can*
  631. set them differently for particular buffers, by explicitly making the
  632. corresponding variables local in those buffers.  *Note Locals::.
  633.  
  634.    Abbrev mode allows you to define abbreviations that automatically
  635. expand as you type them.  For example, `amd' might expand to `abbrev
  636. mode'.  *Note Abbrevs::, for full information.
  637.  
  638.    Icomplete mode displays an indication of available completions when
  639. you are in the minibuffer and completion is active.  *Note Completion
  640. Options::.
  641.  
  642.    Line Number mode enables continuous display in the mode line of the
  643. line number of point.  *Note Mode Line::.
  644.  
  645.    Resize-Minibuffer mode makes the minibuffer expand as necessary to
  646. hold the text that you put in it.  *Note Minibuffer Edit::.
  647.  
  648.    Scroll Bar mode gives each window a scroll bar (*note Scroll
  649. Bars::.).  Menu Bar mode gives each frame a menu bar (*note Menu
  650. Bars::.).  Both of these modes are enabled by default when you use the
  651. X Window System.
  652.  
  653.    In Transient Mark mode, every change in the buffer contents
  654. "deactivates" the mark, so that commands that operate on the region
  655. will get an error.  This means you must either set the mark, or
  656. explicitly "reactivate" it, before each command that uses the region.
  657. The advantage of Transient Mark mode is that Emacs can display the
  658. region highlighted (currently only when using X).  *Note Setting Mark::.
  659.  
  660.    For most minor modes, the command name is also the name of a variable
  661. which directly controls the mode.  The mode is enabled whenever this
  662. variable's value is non-`nil', and the minor mode command works by
  663. setting the variable.  For example, the command `outline-minor-mode'
  664. works by setting the value of `outline-minor-mode' as a variable; it is
  665. this variable that directly turns Outline minor mode on and off.  To
  666. check whether a given minor mode works this way, use `C-h v' to ask for
  667. documentation on the variable name.
  668.  
  669.    These minor mode variables provide a good way for Lisp programs to
  670. turn minor modes on and off; they are also useful in a file's local
  671. variables list.  But please think twice before setting minor modes with
  672. a local variables list, because most minor modes are matter of user
  673. preference--other users editing the same file might not want the same
  674. minor modes you prefer.
  675.  
  676. 
  677. File: emacs,  Node: Variables,  Next: Keyboard Macros,  Prev: Minor Modes,  Up: Customization
  678.  
  679. Variables
  680. =========
  681.  
  682.    A "variable" is a Lisp symbol which has a value.  The symbol's name
  683. is also called the name of the variable.  A variable name can contain
  684. any characters that can appear in a file, but conventionally variable
  685. names consist of words separated by hyphens.  A variable can have a
  686. documentation string which describes what kind of value it should have
  687. and how the value will be used.
  688.  
  689.    Lisp allows any variable to have any kind of value, but most
  690. variables that Emacs uses require a value of a certain type.  Often the
  691. value should always be a string, or should always be a number.
  692. Sometimes we say that a certain feature is turned on if a variable is
  693. "non-`nil'," meaning that if the variable's value is `nil', the feature
  694. is off, but the feature is on for *any* other value.  The conventional
  695. value to use to turn on the feature--since you have to pick one
  696. particular value when you set the variable--is `t'.
  697.  
  698.    Emacs uses many Lisp variables for internal record keeping, as any
  699. Lisp program must, but the most interesting variables for you are the
  700. ones that exist for the sake of customization.  Emacs does not (usually)
  701. change the values of these variables; instead, you set the values, and
  702. thereby alter and control the behavior of certain Emacs commands.  These
  703. variables are called "user options".  Most user options are documented
  704. in this manual, and appear in the Variable Index (*note Variable
  705. Index::.).
  706.  
  707.    One example of a variable which is a user option is `fill-column',
  708. which specifies the position of the right margin (as a number of
  709. characters from the left margin) to be used by the fill commands (*note
  710. Filling::.).
  711.  
  712. * Menu:
  713.  
  714. * Examining::         Examining or setting one variable's value.
  715. * Edit Options::     Examining or editing list of all user options' values.
  716. * Hooks::         Hook variables let you specify programs for parts
  717.                of Emacs to run on particular occasions.
  718. * Locals::         Per-buffer values of variables.
  719. * File Variables::   How files can specify variable values.
  720.  
  721. 
  722. File: emacs,  Node: Examining,  Next: Edit Options,  Up: Variables
  723.  
  724. Examining and Setting Variables
  725. -------------------------------
  726.  
  727. `C-h v VAR RET'
  728.      Display the value and documentation of variable VAR
  729.      (`describe-variable').
  730.  
  731. `M-x set-variable RET VAR RET VALUE RET'
  732.      Change the value of variable VAR to VALUE.
  733.  
  734.    To examine the value of a single variable, use `C-h v'
  735. (`describe-variable'), which reads a variable name using the
  736. minibuffer, with completion.  It displays both the value and the
  737. documentation of the variable.  For example,
  738.  
  739.      C-h v fill-column RET
  740.  
  741. displays something like this:
  742.  
  743.      fill-column's value is 75
  744.      
  745.      Documentation:
  746.      *Column beyond which automatic line-wrapping should happen.
  747.      Automatically becomes buffer-local when set in any fashion.
  748.  
  749. The star at the beginning of the documentation indicates that this
  750. variable is a user option.  `C-h v' is not restricted to user options;
  751. it allows any variable name.
  752.  
  753.    The most convenient way to set a specific user option is with `M-x
  754. set-variable'.  This reads the variable name with the minibuffer (with
  755. completion), and then reads a Lisp expression for the new value using
  756. the minibuffer a second time.  For example,
  757.  
  758.      M-x set-variable RET fill-column RET 75 RET
  759.  
  760. sets `fill-column' to 75.
  761.  
  762.    `M-x set-variable' is limited to user option variables.  You can set
  763. any variable with a Lisp expression using the function `setq'.  Here's
  764. how to use it to set `fill-column':
  765.  
  766.      (setq fill-column 75)
  767.  
  768.    Setting variables, like all means of customizing Emacs except where
  769. otherwise stated, affects only the current Emacs session.
  770.  
  771. 
  772. File: emacs,  Node: Edit Options,  Next: Hooks,  Prev: Examining,  Up: Variables
  773.  
  774. Editing Variable Values
  775. -----------------------
  776.  
  777.    These two functions make it easy to display all the Emacs user option
  778. variables, and to change some of them if you wish.
  779.  
  780. `M-x list-options'
  781.      Display a buffer listing names, values and documentation of all
  782.      options.
  783.  
  784. `M-x edit-options'
  785.      Change user option values by editing a list of user option
  786.      variables.
  787.  
  788.    `M-x list-options' displays a list of all Emacs option variables, in
  789. an Emacs buffer named `*List Options*'.  Each user option is shown with
  790. its documentation and its current value.  Here is what a portion of it
  791. might look like:
  792.  
  793.      ;; exec-path:
  794.      ("." "/usr/local/bin" "/usr/ucb" "/bin" "/usr/bin" "/u2/emacs/etc")
  795.      *List of directories to search programs to run in subprocesses.
  796.      Each element is a string (directory name)
  797.      or nil (try the default directory).
  798.      ;;
  799.      ;; fill-column:
  800.      75
  801.      *Column beyond which automatic line-wrapping should happen.
  802.      Automatically becomes buffer-local when set in any fashion.
  803.      ;;
  804.  
  805.    `M-x edit-options' goes one step further and immediately selects the
  806. `*List Options*' buffer; this buffer uses the major mode Options mode,
  807. which provides commands that allow you to point at a user option
  808. variable and change its value:
  809.  
  810. `s'
  811.      Set the variable point is in or near to a new value read using the
  812.      minibuffer.
  813.  
  814. `x'
  815.      Toggle the variable point is in or near: if the value was `nil',
  816.      it becomes `t'; otherwise it becomes `nil'.
  817.  
  818. `1'
  819.      Set the variable point is in or near to `t'.
  820.  
  821. `0'
  822.      Set the variable point is in or near to `nil'.
  823.  
  824. `n'
  825. `p'
  826.      Move to the next or previous user option.
  827.  
  828.    Any changes take effect immediately, and last until you exit from
  829. Emacs.
  830.  
  831. 
  832. File: emacs,  Node: Hooks,  Next: Locals,  Prev: Edit Options,  Up: Variables
  833.  
  834. Hooks
  835. -----
  836.  
  837.    A "hook" is a variable where you can store a function or functions
  838. to be called on a particular occasion by an existing program.  Emacs
  839. provides a number of hooks for the sake of customization.
  840.  
  841.    Most of the hooks in Emacs are "normal hooks".  These variables
  842. contain lists of functions to be called with no arguments.  The reason
  843. most hooks are normal hooks is so that you can use them in a uniform
  844. way.  Every variable in Emacs whose name ends in `-hook' is a normal
  845. hook.
  846.  
  847.    Most major modes run hooks as the last step of initialization.  This
  848. makes it easy for a user to customize the behavior of the mode, by
  849. overriding the local variable assignments already made by the mode.  But
  850. hooks may also be used in other contexts.  For example, the hook
  851. `suspend-hook' runs just before Emacs suspends itself (*note
  852. Exiting::.).
  853.  
  854.    The recommended way to add a hook function to a normal hook is by
  855. calling `add-hook'.  You can use any valid Lisp function as the hook
  856. function.  For example, here's how to set up a hook to turn on Auto
  857. Fill mode when entering Text mode and other modes based on Text mode:
  858.  
  859.      (add-hook 'text-mode-hook 'turn-on-auto-fill)
  860.  
  861.    The next example shows how to use a hook to customize the indentation
  862. of C code.  (People often have strong personal preferences for one
  863. format compared to another.)  Here the hook function is an anonymous
  864. lambda expression.
  865.  
  866.      (setq my-c-style
  867.        '((c-comment-only-line-offset . 4)
  868.          (c-cleanup-list . (scope-operator
  869.                     empty-defun-braces
  870.                     defun-close-semi))
  871.          (c-offsets-alist . ((arglist-close . c-lineup-arglist)
  872.                  (substatement-open . 0)))))
  873.      
  874.      (add-hook 'c-mode-common-hook
  875.        (function (lambda ()
  876.          (c-add-style "my-style" my-c-style t))))
  877.  
  878.    It is best to design your hook functions so that the order in which
  879. they are executed does not matter.  Any dependence on the order is
  880. "asking for trouble."  However, the order is predictable: the most
  881. recently added hook functions are executed first.
  882.  
  883. 
  884. File: emacs,  Node: Locals,  Next: File Variables,  Prev: Hooks,  Up: Variables
  885.  
  886. Local Variables
  887. ---------------
  888.  
  889. `M-x make-local-variable RET VAR RET'
  890.      Make variable VAR have a local value in the current buffer.
  891.  
  892. `M-x kill-local-variable RET VAR RET'
  893.      Make variable VAR use its global value in the current buffer.
  894.  
  895. `M-x make-variable-buffer-local RET VAR RET'
  896.      Mark variable VAR so that setting it will make it local to the
  897.      buffer that is current at that time.
  898.  
  899.    Almost any variable can be made "local" to a specific Emacs buffer.
  900. This means that its value in that buffer is independent of its value in
  901. other buffers.  A few variables are always local in every buffer.
  902. Every other Emacs variable has a "global" value which is in effect in
  903. all buffers that have not made the variable local.
  904.  
  905.    `M-x make-local-variable' reads the name of a variable and makes it
  906. local to the current buffer.  Further changes in this buffer will not
  907. affect others, and further changes in the global value will not affect
  908. this buffer.
  909.  
  910.    `M-x make-variable-buffer-local' reads the name of a variable and
  911. changes the future behavior of the variable so that it will become local
  912. automatically when it is set.  More precisely, once a variable has been
  913. marked in this way, the usual ways of setting the variable automatically
  914. do `make-local-variable' first.  We call such variables "per-buffer"
  915. variables.
  916.  
  917.    Major modes (*note Major Modes::.) always make variables local to the
  918. buffer before setting the variables.  This is why changing major modes
  919. in one buffer has no effect on other buffers.  Minor modes also work by
  920. setting variables--normally, each minor mode has one controlling
  921. variable which is non-`nil' when the mode is enabled (*note Minor
  922. Modes::.).  For most minor modes, the controlling variable is per
  923. buffer.
  924.  
  925.    Emacs contains a number of variables that are always per-buffer.
  926. These include `abbrev-mode', `auto-fill-function', `case-fold-search',
  927. `comment-column', `ctl-arrow', `fill-column', `fill-prefix',
  928. `indent-tabs-mode', `left-margin', `mode-line-format', `overwrite-mode',
  929. `selective-display-ellipses', `selective-display', `tab-width', and
  930. `truncate-lines'.  Some other variables are always local in every
  931. buffer, but they are used for internal purposes.
  932.  
  933.    A few variables cannot be local to a buffer because they are always
  934. local to each display instead (*Note Multiple Displays::).  If you try
  935. to make one of these variables buffer-local, you'll get an error
  936. message.
  937.  
  938.    `M-x kill-local-variable' reads the name of a variable and makes it
  939. cease to be local to the current buffer.  The global value of the
  940. variable henceforth is in effect in this buffer.  Setting the major mode
  941. kills all the local variables of the buffer except for a few variables
  942. specially marked as "permanent locals".
  943.  
  944.    To set the global value of a variable, regardless of whether the
  945. variable has a local value in the current buffer, you can use the Lisp
  946. construct `setq-default'.  This construct is used just like `setq', but
  947. it sets variables' global values instead of their local values (if
  948. any).  When the current buffer does have a local value, the new global
  949. value may not be visible until you switch to another buffer.  Here is
  950. an example:
  951.  
  952.      (setq-default fill-column 75)
  953.  
  954. `setq-default' is the only way to set the global value of a variable
  955. that has been marked with `make-variable-buffer-local'.
  956.  
  957.    Lisp programs can use `default-value' to look at a variable's
  958. default value.  This function takes a symbol as argument and returns its
  959. default value.  The argument is evaluated; usually you must quote it
  960. explicitly.  For example, here's how to obtain the default value of
  961. `fill-column':
  962.  
  963.      (default-value 'fill-column)
  964.  
  965. 
  966. File: emacs,  Node: File Variables,  Prev: Locals,  Up: Variables
  967.  
  968. Local Variables in Files
  969. ------------------------
  970.  
  971.    A file can specify local variable values for use when you edit the
  972. file with Emacs.  Visiting the file checks for local variables
  973. specifications; it automatically makes these variables local to the
  974. buffer, and sets them to the values specified in the file.
  975.  
  976.    There are two ways to specify local variable values: in the first
  977. line, or with a local variables list.  Here's how to specify them in the
  978. first line:
  979.  
  980.      -*- mode: MODENAME; VAR: VALUE; ... -*-
  981.  
  982. You can specify any number of variables/value pairs in this way, each
  983. pair with a colon and semicolon as shown above.  `mode: MODENAME;'
  984. specifies the major mode; this should come first in the line.  The
  985. VALUEs are not evaluated; they are used literally.  Here is an example
  986. that specifies Lisp mode and sets two variables with numeric values:
  987.  
  988.      ;; -*-mode: Lisp; fill-column: 75; comment-column: 50; -*-
  989.  
  990.    A "local variables list" goes near the end of the file, in the last
  991. page.  (It is often best to put it on a page by itself.)  The local
  992. variables list starts with a line containing the string `Local
  993. Variables:', and ends with a line containing the string `End:'.  In
  994. between come the variable names and values, one set per line, as
  995. `VARIABLE: VALUE'.  The VALUEs are not evaluated; they are used
  996. literally.  If a file has both a local variables list and a `-*-' line,
  997. Emacs processes *everything* in the `-*-' line first, and *everything*
  998. in the local variables list afterward.
  999.  
  1000.    Here is an example of a local variables list:
  1001.  
  1002.      ;;; Local Variables: ***
  1003.      ;;; mode:lisp ***
  1004.      ;;; comment-column:0 ***
  1005.      ;;; comment-start: ";;; "  ***
  1006.      ;;; comment-end:"***" ***
  1007.      ;;; End: ***
  1008.  
  1009.    As you see, each line starts with the prefix `;;; ' and each line
  1010. ends with the suffix ` ***'.  Emacs recognizes these as the prefix and
  1011. suffix based on the first line of the list, by finding them surrounding
  1012. the magic string `Local Variables:'; then it automatically discards
  1013. them from the other lines of the list.
  1014.  
  1015.    The usual reason for using a prefix and/or suffix is to embed the
  1016. local variables list in a comment, so it won't confuse other programs
  1017. that the file is intended as input for.  The example above is for a
  1018. language where comment lines start with `;;; ' and end with `***'; the
  1019. local values for `comment-start' and `comment-end' customize the rest
  1020. of Emacs for this unusual syntax.  Don't use a prefix (or a suffix) if
  1021. you don't need one.
  1022.  
  1023.    Two "variable names" have special meanings in a local variables
  1024. list: a value for the variable `mode' really sets the major mode, and a
  1025. value for the variable `eval' is simply evaluated as an expression and
  1026. the value is ignored.  `mode' and `eval' are not real variables;
  1027. setting variables named `mode' and `eval' in any other context has no
  1028. special meaning.  If `mode' is used to set a major mode, it should be
  1029. the first "variable" in the list.
  1030.  
  1031.    You can use the `mode' "variable" to set minor modes as well as
  1032. major modes; in fact, you can use it more than once, first to set the
  1033. major mode and then to set minor modes which are specific to particular
  1034. buffers.  But most minor modes should not be specified in the file in
  1035. any fashion, because they represent user preferences.  For example, you
  1036. should not try to specify Auto Fill mode with file local variables,
  1037. because whether to use Auto Fill mode for editing a particular kind of
  1038. text is a matter of personal taste, not an aspect of the format of the
  1039. text.
  1040.  
  1041.    The start of the local variables list must be no more than 3000
  1042. characters from the end of the file, and must be in the last page if the
  1043. file is divided into pages.  Otherwise, Emacs will not notice it is
  1044. there.  The purpose of this rule is so that a stray `Local Variables:'
  1045. not in the last page does not confuse Emacs, and so that visiting a
  1046. long file that is all one page and has no local variables list need not
  1047. take the time to search the whole file.
  1048.  
  1049.    You may be tempted to try to turn on Auto Fill mode with a local
  1050. variable list.  That is a mistake.  The choice of Auto Fill mode or not
  1051. is a matter of individual taste, not a matter of the contents of
  1052. particular files.  If you want to use Auto Fill, set up major mode
  1053. hooks with your `.emacs' file to turn it on (when appropriate) for you
  1054. alone (*note Init File::.).  Don't try to use a local variable list
  1055. that would impose your taste on everyone.
  1056.  
  1057.    The variable `enable-local-variables' controls whether to process
  1058. local variables lists, and thus gives you a chance to override them.
  1059. Its default value is `t', which means do process local variables lists.
  1060. If you set the value to `nil', Emacs simply ignores local variables
  1061. lists.  Any other value says to query you about each local variables
  1062. list, showing you the local variables list to consider.
  1063.  
  1064.    The `eval' "variable", and certain actual variables, create a
  1065. special risk; when you visit someone else's file, local variable
  1066. specifications for these could affect your Emacs in arbitrary ways.
  1067. Therefore, the option `enable-local-eval' controls whether Emacs
  1068. processes `eval' variables, as well variables with names that end in
  1069. `-hook', `-hooks', `-function' or `-functions', and certain other
  1070. variables.  The three possibilities for the option's value are `t',
  1071. `nil', and anything else, just as for `enable-local-variables'.  The
  1072. default is `maybe', which is neither `t' nor `nil', so normally Emacs
  1073. does ask for confirmation about file settings for these variables.
  1074.  
  1075.    Use the command `normal-mode' to reset the local variables and major
  1076. mode of a buffer according to the file name and contents, including the
  1077. local variables list if any.  *Note Choosing Modes::.
  1078.  
  1079. 
  1080. File: emacs,  Node: Keyboard Macros,  Next: Key Bindings,  Prev: Variables,  Up: Customization
  1081.  
  1082. Keyboard Macros
  1083. ===============
  1084.  
  1085.    A "keyboard macro" is a command defined by the user to stand for
  1086. another sequence of keys.  For example, if you discover that you are
  1087. about to type `C-n C-d' forty times, you can speed your work by
  1088. defining a keyboard macro to do `C-n C-d' and calling it with a repeat
  1089. count of forty.
  1090.  
  1091. `C-x ('
  1092.      Start defining a keyboard macro (`start-kbd-macro').
  1093.  
  1094. `C-x )'
  1095.      End the definition of a keyboard macro (`end-kbd-macro').
  1096.  
  1097. `C-x e'
  1098.      Execute the most recent keyboard macro (`call-last-kbd-macro').
  1099.  
  1100. `C-u C-x ('
  1101.      Re-execute last keyboard macro, then add more keys to its
  1102.      definition.
  1103.  
  1104. `C-x q'
  1105.      When this point is reached during macro execution, ask for
  1106.      confirmation (`kbd-macro-query').
  1107.  
  1108. `M-x name-last-kbd-macro'
  1109.      Give a command name (for the duration of the session) to the most
  1110.      recently defined keyboard macro.
  1111.  
  1112. `M-x insert-kbd-macro'
  1113.      Insert in the buffer a keyboard macro's definition, as Lisp code.
  1114.  
  1115. `C-x C-k'
  1116.      Edit a previously defined keyboard macro (`edit-kbd-macro').
  1117.  
  1118. `M-x apply-macro-to-region-lines'
  1119.      Run the last keyboard macro on each complete line in the region.
  1120.  
  1121.    Keyboard macros differ from ordinary Emacs commands in that they are
  1122. written in the Emacs command language rather than in Lisp.  This makes
  1123. it easier for the novice to write them, and makes them more convenient
  1124. as temporary hacks.  However, the Emacs command language is not powerful
  1125. enough as a programming language to be useful for writing anything
  1126. intelligent or general.  For such things, Lisp must be used.
  1127.  
  1128.    You define a keyboard macro while executing the commands which are
  1129. the definition.  Put differently, as you define a keyboard macro, the
  1130. definition is being executed for the first time.  This way, you can see
  1131. what the effects of your commands are, so that you don't have to figure
  1132. them out in your head.  When you are finished, the keyboard macro is
  1133. defined and also has been, in effect, executed once.  You can then do
  1134. the whole thing over again by invoking the macro.
  1135.  
  1136. * Menu:
  1137.  
  1138. * Basic Kbd Macro::  Defining and running keyboard macros.
  1139. * Save Kbd Macro::   Giving keyboard macros names; saving them in files.
  1140. * Kbd Macro Query::  Keyboard macros that do different things each use.
  1141.  
  1142.